home *** CD-ROM | disk | FTP | other *** search
- package com.extensibility.xa;
-
- import com.extensibility.app.ApplicationPreferences;
- import com.extensibility.app.BaseAction;
- import com.extensibility.app.BaseWindow;
- import com.extensibility.app.CompositeManager;
- import com.extensibility.app.DialogFactory;
- import com.extensibility.rock.RAction;
- import com.extensibility.rock.RTable;
- import com.extensibility.xml.BaseDeclaration;
- import com.extensibility.xml.InternalPEDeclaration;
- import com.extensibility.xml.ParserException;
- import com.extensibility.xml.URI;
- import java.awt.BorderLayout;
- import java.awt.Component;
- import java.awt.Window;
- import java.awt.event.ActionEvent;
- import java.util.Vector;
- import javax.swing.JFrame;
- import javax.swing.JTextArea;
- import javax.swing.JToolBar;
-
- public class CompositeSchemaWindow extends SchemaWin {
- String findText;
- String replaceText;
- CompositeManager compositeManager;
- ElementPane elemPane;
- AttributePane attrPane;
- AdvancedPane advPane;
- SourcePane srcPane;
- OverviewPane overPane;
- CommentPane cmtPane;
- ErrorPane errPane;
- FilePane filePane;
- BaseAction parseAction;
- BaseAction expandAction = new 2(this, "edit.item.expand", 69);
- BaseAction showDeclAction = new 3(this, "comment.show.decl");
- BaseAction showDocAction = new 4(this, "comment.show.doc");
- BaseAction overviewAction = new 9(this, "view.item.overview", '0');
- BaseAction elementsAction = new 10(this, "view.item.elements", '1');
- BaseAction attributesAction = new 11(this, "view.item.attributes", '2');
- BaseAction advancedAction = new 12(this, "view.item.advanced", '3');
- BaseAction sourceAction = new 13(this, "view.item.source", '8');
- BaseAction fileAction = new 14(this, "view.item.file");
- BaseAction commentsAction = new 15(this, "view.item.comments", '7');
- boolean focusInProgress;
-
- public CompositeSchemaWindow(SchemaDoc var1) {
- super(var1);
- }
-
- public void initialize(ApplicationPreferences var1) {
- super.initialize(var1);
- ((JFrame)this).getContentPane().setLayout(new BorderLayout());
- ((Component)this).setVisible(false);
- this.compositeManager = new CompositeManager(((JFrame)this).getContentPane(), this.getElemPane());
- JToolBar var2 = ((SchemaWin)this).createToolBar();
- if (var2 != null) {
- ((JFrame)this).getContentPane().add(var2, "North");
- }
-
- ((Window)this).addWindowListener(new 1(this));
- this.elementsAction.setEnabled(false);
- this.showDeclAction.setEnabled(false);
- this.showDocAction.setEnabled(false);
- if (var1 != null) {
- if (var1.getShowLeftPane()) {
- this.showHideLeftPane();
- }
-
- if (var1.getShowBottomPane()) {
- this.showHideCommentPane();
- if (((SchemaDoc)((BaseWindow)this).getDocument()).getComments().hasMoreElements()) {
- this.showSchemaNotes();
- }
- }
- }
-
- }
-
- private ElementPane getElemPane() {
- if (this.elemPane == null) {
- this.elemPane = new ElementPane(((SchemaWin)this).getSchemaDoc());
- }
-
- return this.elemPane;
- }
-
- private AttributePane getAttrPane() {
- if (this.attrPane == null) {
- this.attrPane = new AttributePane(((SchemaWin)this).getSchemaDoc());
- }
-
- return this.attrPane;
- }
-
- private AdvancedPane getAdvPane() {
- if (this.advPane == null) {
- this.advPane = new AdvancedPane(((SchemaWin)this).getSchemaDoc());
- }
-
- return this.advPane;
- }
-
- private OverviewPane getOverPane() {
- if (this.overPane == null) {
- this.overPane = new OverviewPane(((SchemaWin)this).getSchemaDoc());
- }
-
- return this.overPane;
- }
-
- private CommentPane getCmtPane() {
- if (this.cmtPane == null) {
- this.cmtPane = new CommentPane(((SchemaWin)this).getSchemaDoc());
- }
-
- return this.cmtPane;
- }
-
- private SourcePane getSrcPane() {
- if (this.srcPane == null) {
- this.srcPane = new SourcePane(((SchemaWin)this).getSchemaDoc());
- }
-
- return this.srcPane;
- }
-
- private ErrorPane getErrPane() {
- if (this.errPane == null) {
- this.errPane = new ErrorPane(((SchemaWin)this).getSchemaDoc());
- }
-
- return this.errPane;
- }
-
- private FilePane getFilePane() {
- if (this.filePane == null) {
- this.filePane = new FilePane(((SchemaWin)this).getSchemaDoc());
- }
-
- return this.filePane;
- }
-
- public void uriUpdateNotify(URI var1, URI var2) {
- CompositePane[] var3 = this.getAllPanes();
-
- for(int var4 = 0; var4 < var3.length; ++var4) {
- if (var3[var4] != null) {
- var3[var4].uriUpdateNotify(var1, var2);
- }
- }
-
- }
-
- public boolean commitPendingEdits(boolean var1) {
- CompositePane[] var2 = this.getAllPanes();
-
- for(int var3 = 0; var3 < var2.length; ++var3) {
- if (var2[var3] != null) {
- boolean var4 = var2[var3].commitPendingEdits(var1);
- if (!var4) {
- return var4;
- }
- }
- }
-
- return true;
- }
-
- public CompositePane[] getTablePanes() {
- return new CompositePane[]{this.elemPane, this.attrPane, this.advPane};
- }
-
- public CompositePane[] getAllPanes() {
- return new CompositePane[]{this.elemPane, this.attrPane, this.advPane, this.overPane, this.cmtPane, this.srcPane, this.errPane, this.filePane};
- }
-
- public CompositePane[] getMainPanes() {
- return new CompositePane[]{this.elemPane, this.attrPane, this.advPane, this.srcPane, this.filePane};
- }
-
- public DeclTable getTableForClass(Class var1) {
- CompositePane[] var2 = this.getMainPanes();
-
- for(int var3 = 0; var3 < var2.length; ++var3) {
- if (var2[var3] != null) {
- DeclTable var4 = var2[var3].getTableForClass(var1);
- if (var4 != null) {
- return var4;
- }
- }
- }
-
- return null;
- }
-
- public Class getCurrentClass() {
- if (this.compositeManager.getMainPane() == this.elemPane) {
- return Class.forName("com.extensibility.xml.ElementDeclaration");
- } else if (this.compositeManager.getMainPane() == this.attrPane) {
- return Class.forName("com.extensibility.xml.AttributeDeclaration");
- } else if (this.compositeManager.getMainPane() == this.advPane) {
- return this.advPane.getCurrentClass();
- } else {
- return this.compositeManager.getMainPane() == this.srcPane ? Class.forName("com.extensibility.xa.SourcePane") : null;
- }
- }
-
- public String getClassName() {
- return "com.extensibility.xa.CompositeSchemaWindow";
- }
-
- protected JToolBar createToolBar(int var1) {
- JToolBar var2 = super.createToolBar(var1);
- return var2;
- }
-
- public ElementDiagram getCurrentDiagram() {
- return this.getElemPane().getCurrentDiagram();
- }
-
- public JTextArea getSourceText() {
- CompositeManager.Pane var1 = this.compositeManager.getMainPane();
- if (!this.compositeManager.setMainPane(this.getSrcPane())) {
- this.compositeManager.setMainPane(var1);
- return null;
- } else {
- JTextArea var2 = this.getSrcPane().getSourceText();
- this.compositeManager.setMainPane(var1);
- return var2;
- }
- }
-
- protected void fillViewMenu() {
- super.fillViewMenu();
- super.muView.addSeparator();
- super.muView.add(this.getElemPane().getZoomInAction());
- super.muView.add(this.getElemPane().getZoomOutAction());
- super.muView.addAsCheckBox(this.getElemPane().getAutoUpdateDiagramAction());
- super.muView.addSeparator();
- this.createExpandAction().addToMenu(super.muView);
- }
-
- protected DeclTable getCurrentTable() {
- return ((CompositePane)this.compositeManager.getMainPane()).getCurrentTable();
- }
-
- protected RAction createExpandAction() {
- return this.expandAction;
- }
-
- protected RAction createCutAction() {
- return new 5(this, "edit.item.cut", 'X');
- }
-
- protected RAction createCopyAction() {
- return new 6(this, "edit.item.copy", 'C');
- }
-
- protected RAction createPasteAction() {
- return new 7(this, "edit.item.paste", 'V');
- }
-
- protected RAction createClearAction() {
- return new 8(this, "edit.item.clear", 'B');
- }
-
- public boolean find(String var1, boolean var2) {
- CompositeManager.Pane var3 = this.compositeManager.getFocusedPane();
- if (var3 == null) {
- ((Window)this).getToolkit().beep();
- return false;
- } else {
- return var3.find(var1, var2);
- }
- }
-
- public void find() {
- String var1 = DialogFactory.askFind(this, this.findText);
- if (var1 != null) {
- this.findText = var1;
- this.find(this.findText, true);
- }
-
- }
-
- public void findAgain() {
- if (this.findText == null) {
- this.find();
- } else {
- this.find(this.findText, false);
- }
-
- }
-
- public void replace() {
- String[] var1 = DialogFactory.askReplace(this, this.findText, this.replaceText);
- if (var1 != null) {
- this.findText = var1[0];
- this.replaceText = var1[1];
- this.findAgain();
- }
-
- }
-
- public void replaceAgain() {
- if (this.getSelectedText() != null && this.getSelectedText().equals(this.findText) && !this.setSelectedText(this.replaceText)) {
- ((Window)this).getToolkit().beep();
- }
-
- this.findAgain();
- }
-
- public String getSelectedText() {
- CompositeManager.Pane var1 = this.compositeManager.getFocusedPane();
- return var1 == null ? null : var1.getSelectedText();
- }
-
- public boolean setSelectedText(String var1) {
- CompositeManager.Pane var2 = this.compositeManager.getFocusedPane();
- if (var2 == null) {
- ((Window)this).getToolkit().beep();
- return false;
- } else {
- return var2.setSelectedText(var1);
- }
- }
-
- public BaseAction createOverviewAction() {
- return this.overviewAction;
- }
-
- protected BaseAction createElementsAction() {
- return this.elementsAction;
- }
-
- protected BaseAction createAttributesAction() {
- return this.attributesAction;
- }
-
- protected BaseAction createAdvancedAction() {
- return this.advancedAction;
- }
-
- protected BaseAction createSourceAction() {
- return this.sourceAction;
- }
-
- protected BaseAction createFileAction() {
- return this.fileAction;
- }
-
- protected BaseAction createCommentsAction() {
- return this.commentsAction;
- }
-
- public DeclTable getTableForModel(DeclTableModel var1) {
- DeclTable var2 = null;
- if (var1 != null) {
- CompositePane[] var3 = this.getTablePanes();
-
- for(int var4 = 0; var4 < var3.length; ++var4) {
- if (var3[var4] != null) {
- var2 = var3[var4].getTableForModel(var1);
- if (var2 != null) {
- break;
- }
- }
- }
- }
-
- return var2;
- }
-
- public void showHideLeftPane() {
- if (this.compositeManager.getLeftPane() == null) {
- this.compositeManager.setLeftPane(this.getOverPane());
- }
-
- boolean var1 = this.compositeManager.isLeftPaneVisible();
- this.compositeManager.showHideLeftPane(!var1);
- if (!var1) {
- this.getOverPane().focusDeclaration(((SchemaWin)this).getSchemaDoc().getFocusedDecl());
- }
-
- }
-
- public void showSchemaNotes() {
- this.getCmtPane().setShowMode(2);
- }
-
- public void showHideCommentPane() {
- boolean var1;
- if (this.compositeManager.getBottomPane() != null && !(this.compositeManager.getBottomPane() instanceof ErrorPane)) {
- var1 = this.compositeManager.isBotPaneVisible();
- } else {
- this.compositeManager.setBottomPane(this.getCmtPane());
- var1 = false;
- }
-
- this.compositeManager.showHideBottomPane(!var1);
- this.showDeclAction.setEnabled(!var1);
- this.showDocAction.setEnabled(!var1);
- if (!var1) {
- this.getCmtPane().focusDeclaration(((SchemaWin)this).getSchemaDoc().getFocusedDecl());
- }
-
- }
-
- public void showErrorPane(boolean var1) {
- if (this.compositeManager.getBottomPane() == null || this.compositeManager.getBottomPane() instanceof CommentPane) {
- this.compositeManager.setBottomPane(this.getErrPane());
- this.getErrPane().resetErrors();
- var1 = false;
- }
-
- boolean var2 = this.compositeManager.isBotPaneVisible();
- this.getErrPane().resetErrors();
- if (var1) {
- this.compositeManager.showHideBottomPane(!var2);
- } else {
- this.compositeManager.showHideBottomPane(true);
- }
-
- }
-
- public void hideErrorPane() {
- if (this.compositeManager.getBottomPane() != null) {
- if (!(this.compositeManager.getBottomPane() instanceof CommentPane)) {
- if (this.compositeManager.getBottomPane() instanceof ErrorPane) {
- this.compositeManager.showHideBottomPane(false);
- }
-
- }
- }
- }
-
- public void showFilePane(ParserException var1) {
- if (((SchemaWin)this).getSchemaDoc().isParsedFromFile()) {
- this.fileAction.actionOccurred((ActionEvent)null);
- this.getFilePane().showError(var1);
- } else {
- this.sourceAction.actionOccurred((ActionEvent)null);
- this.getSrcPane().showError(var1);
- }
-
- }
-
- public void setMainPane(CompositeManager.Pane var1) {
- CompositeManager.Pane var2 = this.compositeManager.getMainPane();
- if (this.compositeManager.setMainPane(var1)) {
- this.elementsAction.setEnabled(var1 != this.elemPane);
- this.attributesAction.setEnabled(var1 != this.attrPane);
- this.advancedAction.setEnabled(var1 != this.advPane);
- this.sourceAction.setEnabled(var1 != this.srcPane);
- this.fileAction.setEnabled(var1 != this.filePane);
- this.elemPane.getAutoUpdateDiagramAction().setEnabled(var1 == this.elemPane);
- this.getCmtPane().focusDeclaration(((SchemaWin)this).getSchemaDoc().getFocusedDecl());
- }
- }
-
- public void selectDeclaration(BaseDeclaration var1) {
- CompositePane[] var2 = this.getMainPanes();
- if (this.overPane != null) {
- this.overPane.select(var1);
- }
-
- if (this.compositeManager.getMainPane() != this.advPane) {
- if (var1 instanceof InternalPEDeclaration && ((InternalPEDeclaration)var1).getAttributeGroup() != null) {
- ((SchemaWin)this).editAttrSet(String.valueOf("%").concat(String.valueOf(var1.getName())));
- return;
- }
-
- if (var1 instanceof InternalPEDeclaration && ((InternalPEDeclaration)var1).getContentModel() != null) {
- ((SchemaWin)this).editModel(String.valueOf("%").concat(String.valueOf(var1.getName())));
- return;
- }
-
- if (var1 instanceof InternalPEDeclaration) {
- ((SchemaWin)this).editText(String.valueOf("%").concat(String.valueOf(var1.getName())));
- return;
- }
- }
-
- for(int var3 = 0; var3 < var2.length; ++var3) {
- if (var2[var3] == null) {
- if (this.elemPane == null) {
- var2[var3] = this.getElemPane();
- } else if (this.attrPane == null) {
- var2[var3] = this.getAttrPane();
- } else {
- if (this.advPane != null) {
- continue;
- }
-
- var2[var3] = this.getAdvPane();
- }
- }
-
- if (var2[var3].select(var1)) {
- this.setMainPane(var2[var3]);
- var2[var3].select(var1);
- break;
- }
- }
-
- }
-
- public BaseAction createGotoAction(BaseDeclaration var1) {
- return new GotoAction(this, var1);
- }
-
- public void declarationFocused(BaseDeclaration var1) {
- if (((SchemaWin)this).getSchemaDoc().getFocusedDecl() != var1) {
- if (!this.focusInProgress) {
- try {
- this.focusInProgress = true;
- super.declarationFocused(var1);
- ((SchemaWin)this).getSchemaDoc().setFocusedDecl(var1);
- CompositePane[] var2 = this.getAllPanes();
-
- for(int var3 = 0; var3 < var2.length; ++var3) {
- if (var2[var3] != null) {
- var2[var3].focusDeclaration(var1);
- }
- }
- } catch (Exception var8) {
- ((Throwable)var8).printStackTrace();
- } finally {
- this.focusInProgress = false;
- }
-
- }
- }
- }
-
- public void diagramUpdated() {
- if (this.elemPane != null) {
- DeclTable var1 = this.elemPane.getCurrentTable();
- if (var1 != null) {
- ((RTable)var1).updateEditor();
- }
-
- }
- }
-
- public void hideConversionErrors() {
- this.compositeManager.setBottomPane(this.getCmtPane());
- this.compositeManager.showHideBottomPane(false);
- }
-
- public void showConversionErrors(Vector var1, URI var2, String var3) {
- this.compositeManager.setBottomPane(new ConversionCheckPane((SchemaDoc)((BaseWindow)this).getDocument(), var1, var2, var3));
- this.compositeManager.showHideBottomPane(true);
- }
-
- // $FF: synthetic method
- static FilePane access$9000571(CompositeSchemaWindow var0) {
- return var0.getFilePane();
- }
-
- // $FF: synthetic method
- static SourcePane access$9000471(CompositeSchemaWindow var0) {
- return var0.getSrcPane();
- }
-
- // $FF: synthetic method
- static CommentPane access$9000171(CompositeSchemaWindow var0) {
- return var0.getCmtPane();
- }
-
- // $FF: synthetic method
- static AdvancedPane access$9000371(CompositeSchemaWindow var0) {
- return var0.getAdvPane();
- }
-
- // $FF: synthetic method
- static AttributePane access$9000271(CompositeSchemaWindow var0) {
- return var0.getAttrPane();
- }
-
- // $FF: synthetic method
- static ElementPane access$9000071(CompositeSchemaWindow var0) {
- return var0.getElemPane();
- }
- }
-